<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The DOMNode class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="domnamednodemap.item.html">DOMNamedNodeMap::item</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="domnode.appendchild.html">DOMNode::appendChild</a></div>
 <div class="up"><a href="book.dom.html">DOM</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.domnode" class="reference">
 <h1 class="title">The DOMNode class</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 4 &gt;= 4.1.0)</p>
 

 
  <div class="section" id="domnode.synopsis">
   <h2 class="title">类摘要</h2>
 

   <div class="classsynopsis">
    <div class="ooclass"></div>
 

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">DOMNode</strong>
     </span>
 
     {</div>

 
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.nodename">$<var class="varname">nodeName</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.nodevalue">$<var class="varname">nodeValue</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">int</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.nodetype">$<var class="varname">nodeType</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.parentnode">$<var class="varname">parentNode</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnodelist.html" class="type DOMNodeList">DOMNodeList</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.childnodes">$<var class="varname">childNodes</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.firstchild">$<var class="varname">firstChild</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.lastchild">$<var class="varname">lastChild</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.previoussibling">$<var class="varname">previousSibling</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.nextsibling">$<var class="varname">nextSibling</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domnamednodemap.html" class="type DOMNamedNodeMap">DOMNamedNodeMap</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.attributes">$<var class="varname">attributes</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="class.domdocument.html" class="type DOMDocument">DOMDocument</a></span>
      <var class="varname"><a href="class.domnode.html#domnode.props.ownerdocument">$<var class="varname">ownerDocument</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.namespaceuri">$<var class="varname">namespaceURI</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.prefix">$<var class="varname">prefix</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.localname">$<var class="varname">localName</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.baseuri">$<var class="varname">baseURI</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domnode.html#domnode.props.textcontent">$<var class="varname">textContent</var></a></var>
    ;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.appendchild.html" class="methodname">appendChild</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$newnode</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.c14n.html" class="methodname">C14N</a></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclusive</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$with_comments</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$xpath</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$ns_prefixes</code></span>
  ]]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domnode.c14nfile.html" class="methodname">C14NFile</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$uri</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclusive</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$with_comments</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$xpath</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$ns_prefixes</code></span>
  ]]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.clonenode.html" class="methodname">cloneNode</a></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$deep</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domnode.getlineno.html" class="methodname">getLineNo</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.getnodepath.html" class="methodname">getNodePath</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.hasattributes.html" class="methodname">hasAttributes</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.haschildnodes.html" class="methodname">hasChildNodes</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.insertbefore.html" class="methodname">insertBefore</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$newnode</code></span>
   [, <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$refnode</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.isdefaultnamespace.html" class="methodname">isDefaultNamespace</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.issamenode.html" class="methodname">isSameNode</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$node</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.issupported.html" class="methodname">isSupported</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$feature</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$version</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.lookupnamespaceuri.html" class="methodname">lookupNamespaceURI</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$prefix</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.lookupprefix.html" class="methodname">lookupPrefix</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="domnode.normalize.html" class="methodname">normalize</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.removechild.html" class="methodname">removeChild</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$oldnode</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.replacechild.html" class="methodname">replaceChild</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$newnode</code></span>
   , <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$oldnode</code></span>
   )</div>

   }</div>

 
  </div>
 

  <div class="section" id="domnode.props">
   <h2 class="title">属性</h2>
   <dl>

    
     <dt id="domnode.props.nodename"><var class="varname"><var class="varname">nodeName</var></var></dt>

     <dd>

      <p class="para">Returns the most accurate name for the current node type</p>
     </dd>

    
    
     <dt id="domnode.props.nodevalue"><var class="varname"><var class="varname">nodeValue</var></var></dt>

     <dd>

      <p class="para">The value of this node, depending on its type</p>
     </dd>

    
    
     <dt id="domnode.props.nodetype"><var class="varname"><var class="varname">nodeType</var></var></dt>

     <dd>

      <p class="para">Gets the type of the node. One of the predefined <a href="dom.constants.html" class="link">XML_xxx_NODE constants</a></p>
     </dd>

    
    
     <dt id="domnode.props.parentnode"><var class="varname"><var class="varname">parentNode</var></var></dt>

     <dd>

      <p class="para">The parent of this node</p>
     </dd>

    
    
     <dt id="domnode.props.childnodes"><var class="varname"><var class="varname">childNodes</var></var></dt>

     <dd>

      <p class="para">
       A <a href="class.domnodelist.html" class="classname">DOMNodeList</a> that contains all
       children of this node. If there are no children, this is an empty
       <a href="class.domnodelist.html" class="classname">DOMNodeList</a>.
      </p>
     </dd>

    
    
     <dt id="domnode.props.firstchild"><var class="varname"><var class="varname">firstChild</var></var></dt>

     <dd>

      <p class="para">
       The first child of this node. If there is no such node, this
       returns <strong><code>NULL</code></strong>.
      </p>
     </dd>

    
    
     <dt id="domnode.props.lastchild"><var class="varname"><var class="varname">lastChild</var></var></dt>

     <dd>

      <p class="para">The last child of this node. If there is no such node, this returns <strong><code>NULL</code></strong>.</p>
     </dd>

    
    
     <dt id="domnode.props.previoussibling"><var class="varname"><var class="varname">previousSibling</var></var></dt>

     <dd>

      <p class="para">
       The node immediately preceding this node. If there is no such
       node, this returns <strong><code>NULL</code></strong>.
      </p>
     </dd>

    
    
     <dt id="domnode.props.nextsibling"><var class="varname"><var class="varname">nextSibling</var></var></dt>

     <dd>

      <p class="para">
       The node immediately following this node. If there is no such
       node, this returns <strong><code>NULL</code></strong>.
      </p>
     </dd>

    
    
     <dt id="domnode.props.attributes"><var class="varname"><var class="varname">attributes</var></var></dt>

     <dd>

      <p class="para">
       A <a href="class.domnamednodemap.html" class="classname">DOMNamedNodeMap</a> containing the
       attributes of this node (if it is a <a href="class.domelement.html" class="classname">DOMElement</a>)
       or <strong><code>NULL</code></strong> otherwise.
      </p>
     </dd>

    
    
     <dt id="domnode.props.ownerdocument"><var class="varname"><var class="varname">ownerDocument</var></var></dt>

     <dd>

      <p class="para">The <a href="class.domdocument.html" class="classname">DOMDocument</a> object associated with this node.</p>
     </dd>

    
    
     <dt id="domnode.props.namespaceuri"><var class="varname"><var class="varname">namespaceURI</var></var></dt>

     <dd>

      <p class="para">The namespace URI of this node, or <strong><code>NULL</code></strong> if it is unspecified.</p>
     </dd>

    
    
     <dt id="domnode.props.prefix"><var class="varname"><var class="varname">prefix</var></var></dt>

     <dd>

      <p class="para">The namespace prefix of this node, or <strong><code>NULL</code></strong> if it is unspecified.</p>
     </dd>

    
    
     <dt id="domnode.props.localname"><var class="varname"><var class="varname">localName</var></var></dt>

     <dd>

      <p class="para">Returns the local part of the qualified name of this node.</p>
     </dd>

    
    
     <dt id="domnode.props.baseuri"><var class="varname"><var class="varname">baseURI</var></var></dt>

     <dd>

      <p class="para">
       The absolute base URI of this node or <strong><code>NULL</code></strong> if the implementation
       wasn&#039;t able to obtain an absolute URI.
      </p>
     </dd>

    
    
     <dt id="domnode.props.textcontent"><var class="varname"><var class="varname">textContent</var></var></dt>

     <dd>

      <p class="para">This attribute returns the text content of this node and its descendants.</p>
     </dd>

    
   </dl>

  </div>



  <div class="section">
   <h2 class="title">注释</h2>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     The DOM extension uses UTF-8 encoding. Use <span class="function"><a href="function.utf8-encode.html" class="function">utf8_encode()</a></span>
     and <span class="function"><a href="function.utf8-decode.html" class="function">utf8_decode()</a></span> to work with texts in ISO-8859-1
     encoding or <a href="ref.iconv.html" class="link">Iconv</a> for other encodings.
    </p>
   </p></blockquote>
  </div>



  <div class="section">
   <h2 class="title">参见</h2>
   <p class="para">
    <ul class="simplelist">
     <li class="member"><a href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1950641247" class="link external">&raquo;&nbsp;W3C specification of Node</a></li>
    </ul>
   </p>
  </div>

 
 </div>
 
 










































































































 
<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="domnode.appendchild.html">DOMNode::appendChild</a> — Adds new child at the end of the children</li><li><a href="domnode.c14n.html">DOMNode::C14N</a> — Canonicalize nodes to a string</li><li><a href="domnode.c14nfile.html">DOMNode::C14NFile</a> — Canonicalize nodes to a file</li><li><a href="domnode.clonenode.html">DOMNode::cloneNode</a> — Clones a node</li><li><a href="domnode.getlineno.html">DOMNode::getLineNo</a> — Get line number for a node</li><li><a href="domnode.getnodepath.html">DOMNode::getNodePath</a> — Get an XPath for a node</li><li><a href="domnode.hasattributes.html">DOMNode::hasAttributes</a> — Checks if node has attributes</li><li><a href="domnode.haschildnodes.html">DOMNode::hasChildNodes</a> — Checks if node has children</li><li><a href="domnode.insertbefore.html">DOMNode::insertBefore</a> — Adds a new child before a reference node</li><li><a href="domnode.isdefaultnamespace.html">DOMNode::isDefaultNamespace</a> — Checks if the specified namespaceURI is the default namespace or not</li><li><a href="domnode.issamenode.html">DOMNode::isSameNode</a> — Indicates if two nodes are the same node</li><li><a href="domnode.issupported.html">DOMNode::isSupported</a> — Checks if feature is supported for specified version</li><li><a href="domnode.lookupnamespaceuri.html">DOMNode::lookupNamespaceURI</a> — Gets the namespace URI of the node based on the prefix</li><li><a href="domnode.lookupprefix.html">DOMNode::lookupPrefix</a> — Gets the namespace prefix of the node based on the namespace URI</li><li><a href="domnode.normalize.html">DOMNode::normalize</a> — Normalizes the node</li><li><a href="domnode.removechild.html">DOMNode::removeChild</a> — Removes child from list of children</li><li><a href="domnode.replacechild.html">DOMNode::replaceChild</a> — Replaces a child</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="domnamednodemap.item.html">DOMNamedNodeMap::item</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="domnode.appendchild.html">DOMNode::appendChild</a></div>
 <div class="up"><a href="book.dom.html">DOM</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
